package com.framework.bdf4j.msg.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.framework.bdf4j.msg.entity.domain.SysMessages;
import com.framework.bdf4j.msg.entity.dto.SysMessagesQueryDTO;
import com.framework.bdf4j.msg.entity.vo.SysMessagesReceiveVo;
import com.framework.bdf4j.msg.entity.vo.SysMessagesVo;
import com.framework.bdf4j.sysadm.entity.SysLog;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 消息基础表
 *
 * @author shan.deng
 * @date 2020-08-03 11:35:03
 */
@Mapper
public interface SysMessagesMapper extends BaseMapper<SysMessages> {



    /**
     * 查询自己发送的消息
     * @param page
     * @param sysMessagesQueryDTO
     * @param userId
     * @return
     */
    IPage<SysMessagesVo> pageMessageMySend(Page page, @Param("ew") QueryWrapper<SysMessagesQueryDTO> wrapper);

    /**
     * 查询自己接收的消息
     * @param page
     * @param sysMessagesQueryDTO
     * @param userId
     * @return
     */
    IPage<SysMessagesReceiveVo> pageMessageMyReceived(Page page, @Param("ew") QueryWrapper<SysMessagesQueryDTO> wrapper, @Param("sysMessagesQueryDTO") SysMessagesQueryDTO sysMessagesQueryDTO, @Param("userId") Integer userId);


    /**
     * 根据消息ID获取详情
     * @param msgId
     * @return
     */
    SysMessagesVo getMessagesResultById(Integer msgId);

    /**
     * 根据消息ID获取收到的消息详情
     * @param msgId
     * @return
     */
    SysMessagesReceiveVo getReceivedMessagesById(@Param("msgId") Integer msgId, @Param("userId") Integer userId);
}
